package com.example.zlx.util;


import java.util.Scanner;
public class model {
    public  static final int n=2;
    public final static double []RI={0,0,0.58,0.90,1.12,1.24,1.32,1.41,1.45,1.49,1.51};
    public static double [][]B=new double[n][n];
    public static double lambda=0;
    public static double CI=0;
    public static double CR=0;
    public static double []weight=new double[n];
    public static void getN(){
        Scanner scanner=new Scanner(System.in);
        String nString=scanner.nextLine();
        String nlineReader=scanner.nextLine();
//	n=Integer.valueOf(nString);
    }
    public static void getB(){
        Scanner scanner=new Scanner(System.in);
        for(int i=0;i<n;i++){
            String lineString=scanner.nextLine();
            int start_index=0;
            for(int j=0;j<n;j++) {
                if(start_index!=0){
                    start_index+=1;
                }
                int end_index=0;
                if(j<n-1){
                    end_index=lineString.indexOf(" ");
                }else{
                    end_index=lineString.length();
                }
                String  tmp=lineString.substring(start_index, end_index);
                lineString=lineString.replaceFirst(" ", "#");
                start_index=end_index;
                tmp=tmp.replaceAll(" ", "");
                double t=Double.valueOf(tmp);
                B[i][j]=t;
            }
        }
        display(B);
    }
    public static void display(double [][]a){
        for(int i=0;i<a.length;i++){
            for(int j=0;j<a[i].length;j++){
                System.out.print(a[i][j]+" ");
            }
            System.out.println("\n");
        }
    }
    public static void display_one(double []a){
        for(int i=0;i<a.length;i++){

            System.out.print(a[i]+" ");
        }
        System.out.println("\n");

    }
    public static void getMaxLambda(){
        EigenvalueDecomposition b=new EigenvalueDecomposition();
        double real[]=b.getRealEigenvalues();
        int n;double max=0;
        max=real[0];
        for(n=1;n<real.length;n++){
            if(real[n]>=max){
                max=real[n];
            }
        }
        lambda=max;
    }
    public static void getCI(){
        CI=(lambda-n)/(n-1);
    }
    public static void getCR(){
        if(n<3){
            CR=0;
        }else{
            CR=CI/RI[n-1];
        }

    }
    public static boolean whetherSatisfied(){
        return CR>0.1?false:true;
    }
    public static void getWeight(){
        double sum1=0,sum2=0;
        double []wi=new double [n];
        double [][]wij=new double [n][n];
        double sum3=0;
        for(int i=0;i<n;i++){
            int j;
            for(j=0;j<n;j++){ sum1=sum1+B[j][i]; }
            for(j=0; j < n; ++ j) { wij[j][i]=B[j][i]/sum1; }
            sum1 = 0;}
        for(int i=0;i<n;i++){
            for(int j=0;j<n;j++){
                sum2=sum2+wij[i][j]; }
            wi[i]=sum2;
            sum2 = 0;
        }
        for(int i=0;i<n;i++){ sum3=sum3+wi[i]; }
        for(int i=0;i<n;i++){ weight[i]=wi[i]/sum3; }
        display_one(weight);
    }
}
